#include <iostream>
#include <vector>

using namespace std;
class Solution
{
public:
    vector<string> fizzBuzz(int n)
    {
        // ans list
        vector<string> ans;

        for (int num = 1; num <= n; num++)
        {

            bool divisibleBy3 = (num % 3 == 0);
            bool divisibleBy5 = (num % 5 == 0);

            if (divisibleBy3 && divisibleBy5)
            {
                // Divides by both 3 and 5, add FizzBuzz
                ans.push_back("FizzBuzz");
            }
            else if (divisibleBy3)
            {
                // Divides by 3, add Fizz
                ans.push_back("Fizz");
            }
            else if (divisibleBy5)
            {
                // Divides by 5, add Buzz
                ans.push_back("Buzz");
            }
            else
            {
                // Not divisible by 3 or 5, add the number
                ans.push_back(to_string(num));
            }
        }

        return ans;
    }
    vector<string> fizzBuzz_2(int n)
    {
        vector<string> result(n);
        for (int i = 1; i <= n; i++)
        {
            string val;
            if (i % 3 == 0)
            {
                val += "Fizz";
            }
            if (i % 5 == 0)
            {
                val += "Buzz";
            }
            if (val.empty())
            {
                val += std::to_string(i);
            }
            result[i - 1] = val;
        }
        return result;
    }
};
int main()
{
    Solution s;
    vector<string> ans = s.fizzBuzz(10);
    for (string a : ans)
    {
        cout << a << " ";
    }
    cout << endl;
    return 0;
}
